const koa = require('koa');
const fs = require('fs');
const app = new koa();

const main = (ctx) => {
    //console.log(ctx.url);
    //ctx.body = 'Hello world';
    //ctx.response.type = 'text'
    //ctx.body = '<h2>hello</h2>'

    if (ctx.url === '/home') {
        ctx.response.type = 'html'
        ctx.body = fs.readFileSync('./assets/template.html', 'utf8')
    }

}
app.use(main)
app.listen(3000, () => {
    console.log('服务启动成功');

})